﻿<UserControl x:Class="LiveTiss.Guias.UserControls.GuiaConsultaReapresentacaoHipoteseDiagnostica"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:guia="clr-namespace:LiveTiss.Guias"
    xmlns:uc="clr-namespace:LiveTiss.Guias.UserControls"
    mc:Ignorable="d" x:Name="uc"
    xmlns:converter="clr-namespace:LiveTiss.Classes.TypeConverter">

    <UserControl.Resources>
        <converter:EnumConverter x:Key="enumConverter"  />
        <converter:BoolToVisibilityConverter x:Key="visibilityConverter" />
    </UserControl.Resources>

    <StackPanel Width="910">
        <Grid x:Name="Agrupamento" Margin="0,19,0,0" VerticalAlignment="Top">
            <Rectangle x:Name="Contorno" RadiusY="6" RadiusX="6" Stroke="#4D898989"/>
            <TextBlock x:Name="Titulo_Agrupamento" TextWrapping="Wrap" Text="Hipóteses Diagnosticadas" Margin="10,10,8,0" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="16"/>
            <StackPanel x:Name="Conteudo_Agrupamento" Margin="12,44,8,0">
                <uc:DiagnosticoAtendimento x:Name="diagnosticoHispotese" 
                    Value="{Binding Path=Value.diagnosticoAtendimento, ElementName=uc, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}" />

                <Grid Margin="0,0,6,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.024*"/>
                        <ColumnDefinition Width="0.976*"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.ColumnSpan="2" Margin="0" Grid.Column="2">
                        <!--Checked="cbxDiag_Checked" Unchecked="cbxDiag_Checked"-->
                        <CheckBox Name="cbxDiag" Content="Diagnostico Secundario" FontFamily="Segoe UI" FontSize="13.333" 
                                   />
                        <Button Name="btnAdd" Width="200" HorizontalAlignment="Left" Content="Adicionar Diagnostico" Click="btnAdd_Click" 
                                Visibility="{Binding Path=IsChecked,ElementName=cbxDiag,Converter={StaticResource visibilityConverter}}" />
                    </StackPanel>
                </Grid>
                <ItemsControl Name="diagnosticoSecundarioControl"
                              ItemsSource="{Binding Path=Value.diagnosticoSecundario, ElementName=uc, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}" 
                              Visibility="{Binding Path=IsChecked,ElementName=cbxDiag,Converter={StaticResource visibilityConverter}}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel x:Name="CIDPanel" Orientation="Vertical" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <ContentControl>
                                <StackPanel Orientation="Vertical" Loaded="StackPanel_Loaded">
                                    <uc:CID x:Name="CIDUserControl" />
                                    <Button Name="btnDelete" Margin="50,0,0,0" Width="100" HorizontalAlignment="Left" Content="Remover" Click="btnDelete_Click"  />
                                </StackPanel>
                            </ContentControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </Grid>
    </StackPanel>
</UserControl>
